package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	/* var name string
	var age int
	fmt.Print("Enter your name: ")
	fmt.Scan(&name)
	fmt.Print("Enter your age:")
	fmt.Scan(&age)

	fmt.Printf("name:%s, age:%d \n", name, age) */

	//带空格或者多行扫描
	fmt.Println("请输入数组,使用空格分割:")
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines) // 使用ScanLines来分割

	if scanner.Scan() {
		word := scanner.Text()
		fmt.Println(word)
	}

/* 	使用reader获取
	fmt.Println("reader读取, 请输入")
	reader := bufio.NewReader(os.Stdin)
	res, _, _ := reader.ReadLine()
	fmt.Println(string(res)) */

}
